package com.htc.callcare.adapter;

import java.util.ArrayList;
import com.htc.callcare.R;
import com.htc.callcare.model.DetailViewModel;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class RecordDetailAdapter extends BaseAdapter{

	ArrayList<DetailViewModel> details;
	LayoutInflater inflater;
	
	
	public RecordDetailAdapter(ArrayList<DetailViewModel> details, Context context) {
		super();
		this.details = details;
		inflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return details.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder = new ViewHolder();
		if(convertView==null){
			convertView = inflater.inflate(R.layout.record_detail_row, null);
			holder.key = (TextView) convertView.findViewById(R.id.key);
			holder.value = (TextView) convertView.findViewById(R.id.value);
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder) convertView.getTag();
		}
		holder.key.setText(details.get(position).getKey());
		holder.value.setText(details.get(position).getValue());
		return convertView;
	}
	
	class ViewHolder{
		TextView key;
		TextView value;
	}
/*	   public boolean areAllItemsEnabled() 
       { 
               return false; 
       } */
       public boolean isEnabled(int position) 
       { 
               return false; 
       } 
}
